JSON-LD
Style
Machine readable data is stored as a JSON object in a 'script' element.
Example
Test HTML code at Schema Markup Validator
<script type="application/ld+json">
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/workplaceHomepage",
"@type": "@id"
},
"Person": "http://xmlns.com/foaf/0.1/Person"
},
"@id": "https://me.example.com",
"@type": "Person",
"name": "John Smith",
"homepage": "https://www.example.com/"
}
</script>
{ "@type": "http://xmlns.com/foaf/0.1/Person", "@id": "https://me.example.com/", "http://xmlns.com/foaf/0.1/name": "John Smith", "http://xmlns.com/foaf/0.1/workplaceHomepage": "https://www.example.com/" }
Benefits
Maps to RDF so can implement any vocabulary.
Disadvantages
Not human readable. Duplicates data in the page or. Maintains separation of human and computer readable data.